
		**********************************************************
		** File: 5_Table_3_results_summarized.do				**
		** Paper: Human Trafficking Indicators: A New Dataset	**
		** Author: Richard Frank								**
		** Date: July 26, 2021									**
		** Task: summaring EBA results to create Table 3		**
 		**********************************************************
	
			clear
			version 16.1
			set max_memory 32g, permanently
			set seed 1234
			set level 95 		
			
	cd "~"

			
	******************************************		
	** STEP 1: Merging results spreadsheets **
	******************************************
	
		** UNODC ** 
		
		import excel "UNODC 2006 EBA results.xlsx", sheet("Sheet1") firstrow case(lower)
		gen round="UNODC"
		order round
		drop   dofile
		save r_u.dta, replace
	
		** DEST **
	
		import excel "HTI dest EBA results.xlsx", sheet("Sheet1") firstrow case(lower) clear
		gen round="DEST"
		order round
		drop dofile      
		destring mean, replace
		destring cdf_pct_above_0, replace
		drop k
		save r_d.dta, replace
	
		** LDEST **
	
		import excel "HTI ldest EBA results.xlsx", sheet("Sheet1") firstrow case(lower) clear
		gen round="LDEST"
		order round
		drop    dofile    
		save r_l.dta, replace
	
		** PDEST **
	
		import excel "HTI pdest EBA results.xlsx", sheet("Sheet1") firstrow case(lower) clear
		gen round="PDEST"
		order round
		drop    dofile    
		save r_p.dta, replace
	
		clear
		use r_u.dta  
		append using r_d.dta , force 
		append using r_l.dta  , force 
		append using r_p.dta , force  
		save eba_results.dta, replace
		erase r_u.dta
		erase r_d.dta 
		erase r_l.dta  
		erase r_p.dta 
	
	*********************************
	** STEP 2: Summarizing results **
	*********************************

 			 
		gen round_num=1
		replace round_num=2 if round=="DEST"
		replace round_num=3 if round=="LDEST"
		replace round_num=4 if round=="PDEST"
		tab round_num
		label var round_num "UNODC=1; DEST=2;LDEST=3;PDEST=4"
		order round round_num
		sort var
		drop if var==""
		gen sm=0
		replace sm=1 if cdf_pct_less_0 <.05 | cdf_pct_less_0 >.95
		replace sm=. if cdf_pct_less_0==.
		sort var
		by var: egen sign=total(sm)
		* browse round var mean sd   cdf_pct_less_0 cdf_pct_above_0 sign
		drop if sign==0
		sort round_num mean 
		gen order=_n
		sort sign var
 
		* 1. GDP * 
		 
		list mean sd pct_sign cdf_pct_above_0 if var=="gdp" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="gdp" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="gdp" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="gdp" & round=="LDEST"
			
		* 2. languageave * 
		 
		list mean sd pct_sign cdf_pct_above_0 if var=="languageave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="languageave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="languageave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="languageave" & round=="LDEST"
			
		* 3. tourismave **
	
		list mean sd pct_sign cdf_pct_above_0 if var=="tourismave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="tourismave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="tourismave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="tourismave" & round=="LDEST"
			
		* 4. legal_britishave **
	
		list mean sd pct_sign cdf_pct_above_0 if var==" legal_britishave " & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var==" legal_britishave " & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var==" legal_britishave " & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var==" legal_britishave " & round=="LDEST"
			
		* 5. french	
   			
 		list mean sd pct_sign cdf_pct_above_0 if var=="french" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="french" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="french" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="french" & round=="LDEST"
			
		* 6. oecd	
   			
 		list mean sd pct_sign cdf_pct_above_0 if var=="oecd" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="oecd" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="oecd" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="oecd" & round=="LDEST"
			
		* 7. peacekeeperslave 				
			
 		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeeperslave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeeperslave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeeperslave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeeperslave" & round=="LDEST"
		
		* 8. refugeesave
	
	 	 list mean sd pct_sign cdf_pct_above_0 if var=="refugeesave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="refugeesave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="refugeesave" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="refugeesave" & round=="LDEST"
	
 
		* 9. easia_pacific
 
 	 	 list mean sd pct_sign cdf_pct_above_0 if var=="easia_pacific" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="easia_pacific" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="easia_pacific" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="easia_pacific" & round=="LDEST"
	
 
		* 10. english
 
 	 	list mean sd pct_sign cdf_pct_above_0 if var=="english" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="english" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="english" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="english" & round=="LDEST"
	
 
		* 11. ethnicave
	
	 	list mean sd pct_sign cdf_pct_above_0 if var=="ethnicave " & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="ethnicave " & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="ethnicave " & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="ethnicave " & round=="LDEST"
	
		* 12. Execright
 
 	 	list mean sd pct_sign cdf_pct_above_0 if var=="execrightave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="execrightave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="execrightave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="execrightave" & round=="LDEST"
	
		* 13 peacekeepersflave
 
  	 	list mean sd pct_sign cdf_pct_above_0 if var=="peacekeepersflave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeepersflave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeepersflave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="peacekeepersflave" & round=="LDEST"
	
		* 14 popave
 
   	 	list mean sd pct_sign cdf_pct_above_0 if var=="popave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="popave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="popave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="popave" & round=="LDEST"
	
		* 15 preventave 
 
    	list mean sd pct_sign cdf_pct_above_0 if var=="preventave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="preventave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="preventave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="preventave" & round=="LDEST"

		* 16. Social global 
	
    	list mean sd pct_sign cdf_pct_above_0 if var=="KOFSoGIave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="KOFSoGIave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="KOFSoGIave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="KOFSoGIave" & round=="LDEST"
		
		* 17. trade
	
    	list mean sd pct_sign cdf_pct_above_0 if var=="tradeave" & round=="UNODC"
		list mean sd pct_sign cdf_pct_above_0 if var=="tradeave" & round=="DEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="tradeave" & round=="PDEST"
		list mean sd pct_sign cdf_pct_above_0 if var=="tradeave" & round=="LDEST"
		 	 
		* 18 german
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="german" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="german" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="german" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="german" & round=="LDEST"
		 	
		* 19 mediaave
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="mediaave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="mediaave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="mediaave" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="mediaave" & round=="LDEST"
		 	
	 	
		* 20 muslimave
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="muslimave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="muslimave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="muslimave" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="muslimave" & round=="LDEST"
		 	
		 	
		* 21 protectave
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="protectave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="protectave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="protectave" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="protectave" & round=="LDEST"
		 	
		* 22 sasia
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="sasia" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="sasia" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="sasia" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="sasia" & round=="LDEST"
		 	
		* 23 ssa
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="ssa" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="ssa" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="ssa" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="ssa" & round=="LDEST"
		 	
			
		* 24 Homicides
	
    	 list mean sd pct_sign cdf_pct_above_0 if var=="homicidesave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="homicidesave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="homicidesave" & round=="PDEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="homicidesave" & round=="LDEST"
		 			
			
		*25 spanish	
			
    	 list mean sd pct_sign cdf_pct_above_0 if var=="spanish" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="spanish" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="spanish" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="spanish" & round=="LDEST"
 
	
		* 26   legal_scanave
	
    	 list mean sd pct_sign cdf_pct_above_0 if var==" legal_scanave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var==" legal_scanave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var==" legal_scanave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var==" legal_scanave" & round=="LDEST"
		
		* 27  weconave
    	 list mean sd pct_sign cdf_pct_above_0 if var=="weconave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="weconave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="weconave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="weconave" & round=="LDEST"	
 
		* 28 unemploymentave
			 list mean sd pct_sign cdf_pct_above_0 if var=="unemploymentave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="unemploymentave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="unemploymentave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="unemploymentave" & round=="LDEST"	   
			
		* 29 urbanave
 
       	 list mean sd pct_sign cdf_pct_above_0 if var=="urbanave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="urbanave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="urbanave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="urbanave" & round=="LDEST"	 
 
		* 29 polity2ave
 
       	 list mean sd pct_sign cdf_pct_above_0 if var=="polity2ave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="polity2ave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="polity2ave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="polity2ave" & round=="LDEST"	 
 
		* 29 pve
 
       	 list mean sd pct_sign cdf_pct_above_0 if var=="pveave" & round=="UNODC"
		 list mean sd pct_sign cdf_pct_above_0 if var=="pveave" & round=="DEST"
		 list mean sd pct_sign cdf_pct_above_0 if var=="pveave" & round=="PDEST" 
		 list mean sd pct_sign cdf_pct_above_0 if var=="pveave" & round=="LDEST"	 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
